//
// Utilities
//

%border-box {
  -moz-box-sizing: border-box;
       box-sizing: border-box;
}

%user-select-none {
  -webkit-user-select: none;
     -moz-user-select: -moz-none;
      -ms-user-select: none;
          user-select: none;
}

%hide-text {
  white-space: nowrap;
  overflow: hidden;
  text-indent: 100%;
  word-wrap: normal;
  overflow-wrap: normal;
  @extend %user-select-none;
}

%truncate-text {
  overflow: hidden;
  white-space: nowrap;
  word-wrap: normal;
  overflow-wrap: normal;
  text-overflow: ellipsis;
}

//
// Boxes
//

%box {
  background: var(--boxBackground);
  border: 1px solid var(--boxBorder);
  border-radius: 3px;
}

%heading-box {
  color: var(--boxHeaderColor);
  background: var(--boxHeaderBackground);
  border: 1px solid var(--boxBorder);
  border-radius: 3px;
}

%block-heading {
  line-height: 1.25rem;
  margin: 2em 0 1em;
  padding: .5em .75em;
  font-size: 1rem;
  overflow: hidden;
  @extend %heading-box;
}

%pre-heading {
  margin: 0;
  padding: .375rem .625rem;
  font-size: inherit;
  font-weight: normal;
  line-height: 1.5;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  @extend %heading-box;

  + pre {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
    margin-top: 0;
  }
}

//
// Notes
//

%note {
  margin: 1.5rem 0;
  padding: .5rem .875rem;
  background: var(--noteBackground);
  border: 1px solid var(--noteBorder);
  border-radius: 3px;
}

%label {
  margin: 0 1px;
  padding: 1px 4px 2px;
  background: var(--labelBackground);
  border-radius: 3px;
}

%block-label {
  display: block;
  line-height: 1.375rem;
  margin: 2em 0 1em;
  padding-left: .5em;
  padding-right: .5em;
  overflow: hidden;
  font-size: inherit;
  color: var(--boxHeaderColor);
  border: 1px solid var(--boxBorder);
  border-radius: 2px;
  @extend %label;
}

%label-yellow {
  background: var(--noteBackground);
  border-color: var(--noteBorder);
}

%note-green, %label-green {
  background: var(--noteGreenBackground);
  border-color: var(--noteGreenBorder);
}

%note-blue, %label-blue {
  background: var(--noteBlueBackground);
  border-color: var(--noteBlueBorder);
}

%note-orange, %label-orange {
  background: var(--noteOrangeBackground);
  border-color: var(--noteOrangeBorder);
}

%note-red, %label-red {
  background: var(--noteRedBackground);
  border-color: var(--noteRedBorder);
}

//
// External links
//

%external-link {
  &:after {
    content: '';
    display: inline-block;
    vertical-align: top;
    width: .5rem;
    height: .5rem;
    margin: .125rem 0 0 .125rem;
    background-size: .5rem .5rem;
    pointer-events: none;

    // <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15,15H2V6h2.595c0,0,0.689-0.896,2.17-2H1C0.447,4,0,4.449,0,5v11c0,0.553,0.447,1,1,1h15c0.553,0,1-0.447,1-1v-3.746 l-2,1.645V15z M13.361,8.05v3.551L20,6.4l-6.639-4.999v3.131C5.3,4.532,5.3,12.5,5.3,12.5C7.582,8.752,8.986,8.05,13.361,8.05z"/></svg>
    background-image: url();
  }
}
html._theme-dark %external-link:after {
  background-image: url();
}

%internal-link:after { content: none !important; }
